<!--
 * @Description: 项目统计
 * @Author: Caroline
 * @Date: 2024-01-16 20:06:31
 * @LastEditTime: 2024-03-10 19:07:06
 * @LastEditors: Caroline
 * @FilePath: \Evaluation-web\src\views\task\cost\personnelStatistic.vue
-->
<template>
  <div class="mod-sys__dict">
    <!-- 1、搜索区 -->
    <el-form :inline="true" :model="state.dataForm" @keyup.enter="state.getDataList()">
      <!-- 测评人员 -->
      <el-form-item>
        <el-input v-model="state.dataForm.userIds" :placeholder="$t('task.userIds')" clearable></el-input>
      </el-form-item>

      <!-- 任务名称 -->
      <el-form-item>
        <el-input v-model="state.dataForm.name" :placeholder="$t('task.name')" clearable></el-input>
      </el-form-item>

      <!-- 时间跨度 -->
      <el-form-item>
        <el-date-picker v-model="state.dataForm.dateRange" type="daterange" :start-placeholder="$t('task.startDate')" :end-placeholder="$t('task.endDate')" />
      </el-form-item>

      <el-form-item>
        <el-button @click="state.getDataList()">{{ $t("query") }}</el-button>
        <el-button @click="onResetDataForm">{{ $t("reset") }}</el-button>
      </el-form-item>
    </el-form>

    <!-- 2、表格区 -->
    <el-table max-height="calc(100vh - 256px)" v-loading="state.dataListLoading" :data="state.dataList" border @selection-change="state.dataListSelectionChangeHandle" @sort-change="state.dataListSortChangeHandle" style="width: 100%">
      <!-- 2.1、表格列 -->
      <el-table-column index label="序号" header-align="center" align="center" min-width="90" />
      <el-table-column prop="userIds" :label="$t('task.userIds')" header-align="center" align="center" min-width="90" />
      <el-table-column prop="name" :label="$t('task.name')" header-align="center" align="center" min-width="90" />
      <el-table-column prop="projectName" :label="$t('task.projectName')" header-align="center" align="center" min-width="90" />
      <el-table-column prop="endDate" :label="$t('task.endDate')" header-align="center" align="center" min-width="90" />
      <el-table-column prop="settlement" :label="$t('task.settlement')" header-align="center" align="center" min-width="90" />
    </el-table>
    <el-pagination :current-page="state.page" :page-sizes="[10, 20, 50, 100]" :page-size="state.limit" :total="state.total" layout="total, sizes, prev, pager, next, jumper" @size-change="state.pageSizeChangeHandle" @current-change="state.pageCurrentChangeHandle"> </el-pagination>
  </div>
</template>

<script lang="ts" setup>
import useView from "@/hooks/useView";
import { reactive, ref, toRefs } from "vue";
import { useI18n } from "vue-i18n";

const { t } = useI18n();

const view = reactive({
  getDataListURL: "",
  getDataListIsPage: true,
  deleteURL: "",
  deleteIsBatch: true,
  dataForm: {
    evaluators: "",
    name: "",
    dateRange: ""
  }
});

const state = reactive({ ...useView(view), ...toRefs(view) });

// 查看详情
const onResetDataForm = async (row: any) => {
  view.dataForm = {
    evaluators: "",
    name: "",
    dateRange: ""
  };
};
</script>
<style lang="less" scoped>
.task-img {
  width: 100px;
  height: 70px;
  object-fit: contain;
}
</style>
